home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1998 January: Mac OS SDK / Dev.CD Jan 98 SDK1.toast / Development Kits (Disc 1) / QuickDraw 3D / RAVE SDK 1.5 MacOS / Headers / RAVE.h < prev   
Encoding:
C/C++ Source or Header  |  1997-08-14  |  42.8 KB  |  1,106 lines  |  [TEXT/MPS ]

  1. /******************************************************************************
  2.  **                                                                             **
  3.  **     Module:        RAVE.h                                                     **
  4.  **                                                                          **
  5.  **     Purpose:     Header file for RAVE API                                 **
  6.  **                                                                          **
  7.  **     Author:        Mike W. Kelley                                             **
  8.  **                    Brent H. Pease                                             **
  9.  **                                                                          **
  10.  **     Copyright (C) 1994-96 Apple Computer, Inc.  All rights reserved.     **
  11.  **        OpenGL™ is a trademark of Silicon Graphics, Inc.                     **
  12.  **                                                                          **
  13.  *****************************************************************************/
  14.  
  15. #ifndef _RAVE_h
  16. #define _RAVE_h
  17.  
  18. #ifdef __cplusplus
  19. extern "C" {
  20. #endif
  21.  
  22. /******************************************************************************
  23.  *
  24.  * Platform macros.
  25.  * This sets kQAPlatform to one of kQAMacOS, kQAWin32, or kQAGeneric.
  26.  * kQAPlatform controls platform-specific compilation switches and types.
  27.  *
  28.  *****************************************************************************/
  29.  
  30. #if !defined(kQAMacOS)
  31. #define    kQAMacOS        1            /* Target is MacOS                    */
  32. #endif
  33.  
  34. #if !defined(kQAGeneric)
  35. #define kQAGeneric        2            /* Target is generic platform        */
  36. #endif
  37.  
  38. #if !defined(kQAWin32)
  39. #define kQAWin32        3            /* Target is Win32                    */
  40. #endif
  41.  
  42. #if defined(_WIN32) || defined(_WINDOWS)
  43.     #define kQAPlatform kQAWin32
  44. #elif !defined(kQAPlatform)
  45.     #define kQAPlatform kQAMacOS
  46. #endif
  47.  
  48. /******************************************************************************
  49.  *
  50.  * Export Control
  51.  *
  52.  *****************************************************************************/
  53.  
  54. #if defined(_MSC_VER)    /* Microsoft Visual C */
  55.     #if defined(WIN32_RAVEEXPORTING)    /* define when building DLL */
  56.         #define    RAVE_EXPORT        __declspec( dllexport )
  57.         #define RAVE_CALL
  58.         #define RAVE_CALLBACK
  59.     #else
  60.         #define RAVE_EXPORT        __declspec( dllimport )
  61.         #define RAVE_CALL        __cdecl
  62.         #define RAVE_CALLBACK    __cdecl
  63.     #endif /* WIN32_RAVEEXPORTING */
  64. #else
  65.     #define RAVE_EXPORT
  66.     #define RAVE_CALL
  67.     #define RAVE_CALLBACK
  68. #endif /* _MSC_VER */
  69.  
  70. /******************************************************************************
  71.  *
  72.  * Platform dependent datatypes: TQAImagePixelType, TQADevice, TQAClip, and TQARect.
  73.  *
  74.  *****************************************************************************/
  75.  
  76. typedef enum TQAImagePixelType
  77. {
  78.     kQAPixel_Alpha1        = 0,        /* 1 bit/pixel alpha */
  79.     kQAPixel_RGB16        = 1,        /* 16 bit/pixel, R=14:10, G=9:5, B=4:0 */
  80.     kQAPixel_ARGB16        = 2,        /* 16 bit/pixel, A=15, R=14:10, G=9:5, B=4:0 */
  81.     kQAPixel_RGB32        = 3,        /* 32 bit/pixel, R=23:16, G=15:8, B=7:0 */
  82.     kQAPixel_ARGB32        = 4,        /* 32 bit/pixel, A=31:24, R=23:16, G=15:8, B=7:0 */
  83.     kQAPixel_CL4        = 5,        /* 4 bit color look up table, always big endian,
  84.                                         ie high 4 bits effect left pixel */
  85.     kQAPixel_CL8        = 6            /* 8 bit color look up table */
  86. #if (kQAPlatform == kQAWin32)
  87.     ,
  88.     kQAPixel_RGB16_565    = 7,        /* 16 bits/pixel, no alpha, R:5, G:6, B:5 */
  89.     kQAPixel_RGB24        = 8            /* 24 bits/pixel, no alpha, R:8, G:8, B:8 */
  90. #endif /* kQAPlatform == kQAWin32 */
  91. } TQAImagePixelType;
  92.  
  93. typedef enum TQAColorTableType
  94. {
  95.     kQAColorTable_CL8_RGB32        = 0,        /* 256 entry, 32 bit/pixel, R=23:16, G=15:8, B=7:0 */
  96.     kQAColorTable_CL4_RGB32        = 1            /* 16 entry, 32 bit/pixel, R=23:16, G=15:8, B=7:0 */
  97. } TQAColorTableType;
  98.  
  99. typedef enum TQADeviceType            /* Selects target device type */
  100. {
  101.     kQADeviceMemory        = 0,        /* Memory draw context */
  102.     kQADeviceGDevice    = 1,        /* Macintosh GDevice draw context */
  103.     kQADeviceWin32DC    = 2            /* Win32 DC */
  104. #if !defined(RAVE_NO_DIRECTDRAW)
  105.     ,
  106.     kQADeviceDDSurface    = 3            /* Win32 DirectDraw Surface */
  107. #endif /* !defined(RAVE_NO_DIRECTDRAW) */
  108. } TQADeviceType;
  109.  
  110. typedef struct TQADeviceMemory        /* Generic memory pixmap device */
  111. {
  112.     long                rowBytes;    /* Rowbytes */
  113.     TQAImagePixelType    pixelType;    /* Depth, color space, etc. */
  114.     long                width;        /* Width in pixels */
  115.     long                height;        /* Height in pixels */
  116.     void                *baseAddr;    /* Base address of pixmap */
  117. } TQADeviceMemory;
  118.  
  119. typedef enum TQAClipType            /* Selects target clip type */
  120. {
  121.     kQAClipRgn            = 0,        /* Macintosh clipRgn with serial number */
  122.     kQAClipWin32Rgn        = 1            /* Win32 clip region */
  123. } TQAClipType;
  124.  
  125. typedef struct TQARect
  126. {
  127.     long                left;
  128.     long                right;
  129.     long                top;
  130.     long                bottom;
  131. } TQARect;
  132.  
  133. #if (kQAPlatform == kQAMacOS)
  134.  
  135.     /*
  136.     ** the following gets around a problem in xlc with unsigned 32 bit enums 
  137.     ** that have been defined in system header files
  138.     */
  139.     #if defined(__xlc) || defined(__xlC) || defined(__xlC__) || defined(__XLC121__)
  140.         #pragma options enum=small
  141.     #endif
  142.     
  143.     /*
  144.      * MacOS supports memory and GDevice. TQARect == Rect. TQAClip is a clipRgn.
  145.      */
  146.     #include <Quickdraw.h>
  147.     #include <QDOffscreen.h>
  148.     
  149.     /*
  150.     ** reset to default after the system headers
  151.     */
  152.     
  153.     #if defined(__xlc) || defined(__xlC) || defined(__xlC__) || defined(__XLC121__)
  154.         #pragma options enum=reset
  155.     #endif
  156.         
  157.     
  158.     typedef union TQAPlatformDevice
  159.     {
  160.         TQADeviceMemory    memoryDevice;
  161.         GDHandle        gDevice;
  162.     } TQAPlatformDevice;
  163.     
  164.     typedef union TQAPlatformClip
  165.     {
  166.         RgnHandle        clipRgn;
  167.     } TQAPlatformClip;
  168.     
  169. #elif (kQAPlatform == kQAWin32)
  170.     #include <windows.h>
  171. #if !defined(RAVE_NO_DIRECTDRAW)
  172.     #include <ddraw.h>
  173.  
  174.     typedef enum
  175.     {
  176.         kQADirectDrawObject        = 1,
  177.         kQADirectDrawObject2    = 2
  178.     } TQADirectDrawObjectSelector;
  179.  
  180.     typedef enum
  181.     {
  182.         kQADirectDrawSurface    = 1,
  183.         kQADirectDrawSurface2    = 2
  184.     } TQADirectDrawSurfaceSelector;
  185.  
  186. #endif /* !RAVE_NO_DIRECTDRAW */
  187.  
  188.     typedef union TQAPlatformDevice
  189.     {
  190.         TQADeviceMemory            memoryDevice;
  191.         HDC                        hdc;
  192. #if !defined(RAVE_NO_DIRECTDRAW)
  193.         struct
  194.         {
  195.             TQADirectDrawObjectSelector        objectSelector;
  196.             union
  197.             {
  198.                 LPDIRECTDRAW                lpDirectDraw;
  199.                 LPDIRECTDRAW2                lpDirectDraw2;
  200.             };
  201.  
  202.             TQADirectDrawSurfaceSelector    surfaceSelector;
  203.             union
  204.             {
  205.                 LPDIRECTDRAWSURFACE            lpDirectDrawSurface;
  206.                 LPDIRECTDRAWSURFACE2        lpDirectDrawSurface2;
  207.             };
  208.         };
  209. #endif /* RAVE_NO_DIRECTDRAW */
  210.     } TQAPlatformDevice;
  211.  
  212.     typedef union TQAPlatformClip
  213.     {
  214.         HRGN            clipRgn;
  215.     } TQAPlatformClip;
  216. #elif (kQAPlatform == kQAGeneric)
  217.     /*
  218.      * Generic platform supports memory device only. TQARect is generic. TQAClip is ???.
  219.      */
  220.     
  221.     typedef union TQAPlatformDevice
  222.     {
  223.         TQADeviceMemory    memoryDevice;
  224.     } TQAPlatformDevice;
  225.     
  226.     typedef union TQAPlatformClip
  227.     {
  228.         void            *region;            /* ??? */
  229.     } TQAPlatformClip;
  230. #else
  231.     /* ??? Unrecognized kQAPlatform */
  232. #endif
  233.  
  234. typedef struct TQADevice
  235. {
  236.     TQADeviceType        deviceType;
  237.     TQAPlatformDevice    device;
  238. } TQADevice;
  239.  
  240. typedef struct TQAClip
  241. {
  242.     TQAClipType            clipType;
  243.     TQAPlatformClip        clip;
  244. } TQAClip;
  245.  
  246. /******************************************************************************
  247.  *
  248.  * Basic data types.
  249.  *
  250.  *****************************************************************************/
  251.  
  252. typedef struct    TQADrawContext TQADrawContext;    /* Drawing context for an engine */
  253. typedef struct    TQAEngine TQAEngine;            /* Pointer to a drawing engine */
  254. typedef struct    TQATexture TQATexture;            /* Pointer to an allocated texture map */
  255. typedef struct    TQABitmap TQABitmap;            /* Pointer to an allocated bitmap */
  256. typedef struct    TQADrawPrivate TQADrawPrivate;    /* Engine's private draw context pointer */
  257. typedef struct    TQAImage TQAImage;                /* An image for use as texture or bitmap */
  258. typedef struct    TQAColorTable TQAColorTable;
  259.  
  260. typedef struct TQAIndexedTriangle                /* A single triangle element for QADrawTriMesh */
  261. {
  262.     unsigned long    triangleFlags;                /* Triangle flags, see kQATriFlags_ */
  263.     unsigned long    vertices[3];                /* Indices into a vertex array */
  264. } TQAIndexedTriangle;
  265.  
  266. struct TQAImage                                    /* An image for use as texture or bitmap */
  267. {
  268.     long        width;                            /* Width of pixmap */
  269.     long        height;                            /* Height of pixmap */
  270.     long        rowBytes;                        /* Rowbytes of pixmap */
  271.     void        *pixmap;                        /* Pixmap */
  272. };
  273.  
  274. typedef enum TQAError                            /* Standard error type */
  275. {
  276.     kQANoErr                = 0,                /* No error */
  277.     kQAError                = 1,                /* Generic error flag */
  278.     kQAOutOfMemory            = 2,                /* Insufficient memory */
  279.     kQANotSupported            = 3,                /* Requested feature is not supported */
  280.     kQAOutOfDate            = 4,                /* A newer drawing engine was registered */
  281.     kQAParamErr                = 5,                /* Error in passed parameters */
  282.     kQAGestaltUnknown        = 6,                /* Requested gestalt type isn't available */
  283.     kQADisplayModeUnsupported    = 7,            /* Engine cannot render to the display in its current ,
  284.                                                  * mode, but could if it were in some other mode */
  285.     kQAOutOfVideoMemory        = 8                    /* There is not enough VRAM to support the desired
  286.                                                  * context dimensions */
  287. } TQAError;
  288.  
  289. /************************************************************************************************
  290.  *
  291.  * Vertex data types.
  292.  *
  293.  ***********************************************************************************************/
  294.  
  295. /*
  296.  * TQAVGouraud is used for Gouraud shading. Each vertex specifies position, color and Z.
  297.  *
  298.  * Alpha is always treated as indicating transparency. Drawing engines which don't
  299.  * support Z-sorted rendering use the back-to-front transparency blending functions
  300.  * shown below. (ARGBsrc are the source (new) values, ARGBdest are  the destination
  301.  * (previous) pixel values.)
  302.  *
  303.  *        Premultiplied                            Interpolated
  304.  *
  305.  *        A = 1 - (1 - Asrc) * (1 - Adest)        A = 1 - (1 - Asrc) * (1 - Adest) 
  306.  *        R = (1 - Asrc) * Rdest + Rsrc            R = (1 - Asrc) * Rdest + Asrc * Rsrc
  307.  *        G = (1 - Asrc) * Gdest + Gsrc            G = (1 - Asrc) * Gdest + Asrc * Gsrc
  308.  *        B = (1 - Asrc) * Bdest + Bsrc            B = (1 - Asrc) * Bdest + Asrc * Bsrc
  309.  *
  310.  * Note that the use of other blending modes to implement antialiasing is performed
  311.  * automatically by the drawing engine when the kQATag_Antialias variable !=
  312.  * kQAAntiAlias_Fast. The driving software should continue to use the alpha fields
  313.  * for transparency even when antialiasing is being used (the drawing engine will
  314.  * resolve the multiple blending requirements as best as it can).
  315.  *
  316.  * Drawing engines which perform front-to-back Z-sorted rendering should replace
  317.  * the blending function shown above with the equivalent front-to-back formula.
  318.  */
  319.  
  320. typedef struct TQAVGouraud
  321. {
  322.     float                x;        /* X pixel coordinate, 0.0 <= x < width */
  323.     float                y;        /* Y pixel coordinate, 0.0 <= y < height */
  324.     float                z;        /* Z coordinate, 0.0 <= z <= 1.0 */
  325.     float                invW;    /* 1 / w; required only when kQAPerspectiveZ_On is set */
  326.     
  327.     float                r;        /* Red, 0.0 <= r <= 1.0 */
  328.     float                g;        /* Green, 0.0 <= g <= 1.0 */
  329.     float                b;        /* Blue, 0.0 <= b <= 1.0 */
  330.     float                a;        /* Alpha, 0.0 <= a <= 1.0, 1.0 is opaque */
  331. } TQAVGouraud;
  332.  
  333. /*
  334.  * TQAVTexture is used for texture mapping. The texture mapping operation
  335.  * is controlled by the kQATag_TextureOp variable, which is a mask of
  336.  * kQATextureOp_None/Modulate/Highlight/Decal. Below is pseudo-code for the
  337.  * texture shading operation:
  338.  *
  339.  *        texPix = TextureLookup (uq/q, vq/q);
  340.  *        if (kQATextureOp_Decal)
  341.  *        {
  342.  *            texPix.r = texPix.a * texPix.r + (1 - texPix.a) * r;
  343.  *            texPix.g = texPix.a * texPix.g + (1 - texPix.a) * g;
  344.  *            texPix.b = texPix.a * texPix.b + (1 - texPix.a) * b;
  345.  *            texPix.a = a;
  346.  *        }
  347.  *        else
  348.  *        {
  349.  *            texPix.a = texPix.a * a;
  350.  *        }
  351.  *        if (kQATextureOp_Modulate)
  352.  *        {
  353.  *            texPix.r *= kd_r;        // Clamped to prevent overflow
  354.  *            texPix.g *= kd_g;        // Clamped to prevent overflow
  355.  *            texPix.b *= kd_b;        // Clamped to prevent overflow
  356.  *        }
  357.  *        if (kQATextureOp_Highlight)
  358.  *        {
  359.  *            texPix.r += ks_r;        // Clamped to prevent overflow
  360.  *            texPix.g += ks_g;        // Clamped to prevent overflow
  361.  *            texPix.b += ks_b;        // Clamped to prevent overflow
  362.  *        }
  363.  *
  364.  * After computation of texPix, transparency blending (as shown
  365.  * above for TQAVGouraud) is performed.
  366.  */
  367.  
  368. typedef struct TQAVTexture
  369. {
  370.     float                x;        /* X pixel coordinate, 0.0 <= x < width */
  371.     float                y;        /* Y pixel coordinate, 0.0 <= y < height */
  372.     float                z;        /* Z coordinate, 0.0 <= z <= 1.0 */
  373.     float                invW;    /* 1 / w (always required) */
  374.     
  375.     /* rgb are used only when kQATextureOp_Decal is set. a is always required */
  376.     
  377.     float                r;        /* Red, 0.0 <= r <= 1.0 */
  378.     float                g;        /* Green, 0.0 <= g <= 1.0 */
  379.     float                b;        /* Blue, 0.0 <= b <= 1.0 */
  380.     float                a;        /* Alpha, 0.0 <= a <= 1.0, 1.0 is opaque */
  381.  
  382.     /* uOverW and vOverW are required by all modes */
  383.     
  384.     float                uOverW;    /* u / w */
  385.     float                vOverW;    /* v / w */
  386.     
  387.     /* kd_r/g/b are used only when kQATextureOp_Modulate is set */
  388.     
  389.     float                kd_r;    /* Scale factor for texture red, 0.0 <= kd_r */
  390.     float                kd_g;    /* Scale factor for texture green, 0.0 <= kd_g */
  391.     float                kd_b;    /* Scale factor for texture blue, 0.0 <= kd_b */
  392.     
  393.     /* ks_r/g/b are used only when kQATextureOp_Highlight is set */
  394.     
  395.     float                ks_r;    /* Red specular highlight, 0.0 <= ks_r <= 1.0 */
  396.     float                ks_g;    /* Green specular highlight, 0.0 <= ks_g <= 1.0 */
  397.     float                ks_b;    /* Blue specular highlight, 0.0 <= ks_b <= 1.0 */
  398. } TQAVTexture;
  399.  
  400. /************************************************************************************************
  401.  *
  402.  * Constants used for the state variables.
  403.  *
  404.  ***********************************************************************************************/
  405.  
  406. /*
  407.  * kQATag_xxx is used to select a state variable when calling QASetFloat(), QASetInt(),
  408.  * QAGetFloat() and QAGetInt(). The kQATag values are split into two separate
  409.  * enumerated types: TQATagInt and TQATagFloat. TQATagInt is used for the QASet/GetInt()
  410.  * functions, and TQATagFloat is used for the QASet/GetFloat() functions. (This is so
  411.  * that a compiler that typechecks enums can flag a float/int tag mismatch during compile.)
  412.  *
  413.  * These variables are required by all drawing engines:
  414.  *        kQATag_ZFunction            (Int)    One of kQAZFunction_xxx
  415.  *        kQATag_ColorBG_a            (Float)    Background color alpha
  416.  *        kQATag_ColorBG_r            (Float)    Background color red
  417.  *        kQATag_ColorBG_g            (Float)    Background color green
  418.  *        kQATag_ColorBG_b            (Float)    Background color blue
  419.  *        kQATag_Width                (Float)    Line and point width (pixels)
  420.  *        kQATag_ZMinOffset            (Float)    Min offset to Z to guarantee visibility (Read only!)
  421.  *        kQATag_ZMinScale            (Float)    Min scale to Z to guarantee visibility (Read only!)
  422.  
  423.  * These variables are used for optional features:
  424.  *        kQATag_Antialias            (Int)    One of kQAAntiAlias_xxx
  425.  *        kQATag_Blend                (Int)    One of kQABlend_xxx
  426.  *        kQATag_PerspectiveZ            (Int)    One of kQAPerspectiveZ_xxx
  427.  *        kQATag_TextureFilter        (Int)    One of kQATextureFilter_xxx
  428.  *        kQATag_TextureOp            (Int)    Mask of kQATextureOp_xxx
  429.  *        kQATag_Texture                (Int)    Pointer to current TQATexture
  430.  *        kQATag_CSGTag                (Int)    One of kQACSGTag_xxx
  431.  *        kQATag_CSGEquation            (Int)    32 bit CSG truth table
  432.  *
  433.  * These variables are used for OpenGL™ support:
  434.  *        kQATagGL_DrawBuffer            (Int)    Mask of kQAGL_DrawBuffer_xxx
  435.  *        kQATagGL_TextureWrapU        (Int)    kQAGL_Clamp or kQAGL_Repeat
  436.  *        kQATagGL_TextureWrapV        (Int)    kQAGL_Clamp or kQAGL_Repeat
  437.  *        kQATagGL_TextureMagFilter    (Int)    kQAGL_Nearest or kQAGL_Linear
  438.  *        kQATagGL_TextureMinFilter    (Int)    kQAGL_Nearest, etc.
  439.  *        kQATagGL_ScissorXMin        (Int)    Minimum X value for scissor rectangle
  440.  *        kQATagGL_ScissorYMin        (Int)    Minimum Y value for scissor rectangle
  441.  *        kQATagGL_ScissorXMax        (Int)    Maximum X value for scissor rectangle
  442.  *        kQATagGL_ScissorYMax        (Int)    Maximum Y value for scissor rectangle
  443.  *        kQATagGL_BlendSrc            (Int)    Source blending operation
  444.  *        kQATagGL_BlendDst            (Int)    Destination blending operation
  445.  *        kQATagGL_LinePattern        (Int)    Line rasterization pattern
  446.  *        kQATagGL_AreaPattern0        (Int)    First of 32 area pattern registers
  447.  *        kQATagGL_AreaPattern31        (Int)    Last of 32 area pattern registers
  448.  *        kQATagGL_DepthBG            (Float)    Background Z
  449.  *        kQATagGL_TextureBorder_a    (Float)    Texture border color alpha
  450.  *        kQATagGL_TextureBorder_r    (Float)    Texture border color red
  451.  *        kQATagGL_TextureBorder_g    (Float)    Texture border color green
  452.  *        kQATagGL_TextureBorder_b    (Float)    Texture border color blue
  453.  *
  454.  * Tags >= kQATag_EngineSpecific_Minimum may be assigned by the vendor for use as
  455.  * engine-specific variables. NOTE: These should be used only in exceptional circumstances,
  456.  * as functions performed by these variables won't be generally accessible. All other tag
  457.  * values are reserved.
  458.  *
  459.  *        kQATag_EngineSpecific_Minimum    Minimum tag value for drawing-engine specific variables
  460.  */
  461.  
  462. typedef enum TQATagInt
  463. {
  464.     kQATag_ZFunction                = 0,
  465.     kQATag_Antialias                = 8,
  466.     kQATag_Blend                    = 9,
  467.     kQATag_PerspectiveZ                = 10,
  468.     kQATag_TextureFilter            = 11,
  469.     kQATag_TextureOp                = 12,
  470.     kQATag_CSGTag                    = 14,
  471.     kQATag_CSGEquation                = 15,
  472.     kQATag_BufferComposite            = 16,
  473.     kQATagGL_DrawBuffer                = 100,
  474.     kQATagGL_TextureWrapU            = 101,
  475.     kQATagGL_TextureWrapV            = 102,
  476.     kQATagGL_TextureMagFilter        = 103,
  477.     kQATagGL_TextureMinFilter        = 104,
  478.     kQATagGL_ScissorXMin            = 105,
  479.     kQATagGL_ScissorYMin            = 106,
  480.     kQATagGL_ScissorXMax            = 107,
  481.     kQATagGL_ScissorYMax            = 108,
  482.     kQATagGL_BlendSrc                = 109,
  483.     kQATagGL_BlendDst                = 110,
  484.     kQATagGL_LinePattern            = 111,
  485.     kQATagGL_AreaPattern0            = 117,
  486.         /* ...1-30 */
  487.     kQATagGL_AreaPattern31            = 148,
  488.     kQATag_EngineSpecific_Minimum    = 1000
  489. } TQATagInt;
  490.  
  491. typedef enum TQATagPtr
  492. {
  493.     kQATag_Texture                    = 13
  494. } TQATagPtr;
  495.  
  496. typedef enum TQATagFloat
  497. {
  498.     kQATag_ColorBG_a                = 1,
  499.     kQATag_ColorBG_r                = 2,
  500.     kQATag_ColorBG_g                = 3,
  501.     kQATag_ColorBG_b                = 4,
  502.     kQATag_Width                    = 5,
  503.     kQATag_ZMinOffset                = 6,
  504.     kQATag_ZMinScale                = 7,
  505.     kQATagGL_DepthBG                = 112,
  506.     kQATagGL_TextureBorder_a        = 113,
  507.     kQATagGL_TextureBorder_r        = 114,
  508.     kQATagGL_TextureBorder_g        = 115,
  509.     kQATagGL_TextureBorder_b        = 116
  510. } TQATagFloat;
  511.  
  512. /* kQATag_ZFunction */
  513. #define kQAZFunction_None            0    /* Z is neither tested nor written (same as no Z buffer) */
  514. #define kQAZFunction_LT                1    /* Znew < Zbuffer is visible */
  515. #define kQAZFunction_EQ                2    /* OpenGL Only: Znew == Zbuffer is visible */
  516. #define kQAZFunction_LE                3    /* OpenGL Only: Znew <= Zbuffer is visible */
  517. #define kQAZFunction_GT                4    /* OpenGL Only: Znew > Zbuffer is visible */
  518. #define kQAZFunction_NE                5    /* OpenGL Only: Znew != Zbuffer is visible */
  519. #define kQAZFunction_GE                6    /* OpenGL Only: Znew >= Zbuffer is visible */
  520. #define kQAZFunction_True            7    /* Znew is always visible */
  521.  
  522. /* kQATag_Width */
  523. #define kQAMaxWidth                    128.0
  524.  
  525. /* kQATag_Antialias */
  526. #define kQAAntiAlias_Off            0
  527. #define kQAAntiAlias_Fast            1
  528. #define kQAAntiAlias_Mid            2
  529. #define kQAAntiAlias_Best            3
  530.  
  531. /* kQATag_Blend */
  532. #define kQABlend_PreMultiply        0
  533. #define kQABlend_Interpolate        1
  534. #define kQABlend_OpenGL                2
  535.  
  536. /* kQATag_BufferComposite */
  537. #define kQABufferComposite_None            0    /* Default: New pixels overwrite initial buffer contents */
  538. #define kQABufferComposite_PreMultiply    1    /* New pixels are blended with initial buffer contents via PreMultiply */
  539. #define kQABufferComposite_Interpolate    2    /* New pixels are blended with initial buffer contents via Interpolate */
  540.  
  541. /* kQATag_PerspectiveZ */
  542. #define kQAPerspectiveZ_Off            0    /* Use Z for hidden surface removal */
  543. #define kQAPerspectiveZ_On            1    /* Use InvW for hidden surface removal */
  544.  
  545. /* kQATag_TextureFilter */
  546. #define kQATextureFilter_Fast        0
  547. #define kQATextureFilter_Mid        1
  548. #define kQATextureFilter_Best        2
  549.  
  550. /* kQATag_TextureOp (mask of one or more) */
  551. #define kQATextureOp_None        0                /* Default texture mapping mode */
  552. #define kQATextureOp_Modulate    (1 << 0)        /* Modulate texture color with kd_r/g/b */
  553. #define kQATextureOp_Highlight    (1 << 1)        /* Add highlight value ks_r/g/b */
  554. #define kQATextureOp_Decal        (1 << 2)        /* When texture alpha == 0, use rgb instead */
  555. #define kQATextureOp_Shrink        (1 << 3)        /* This is a non-wrapping texture, so the ??? */
  556.  
  557. /* kQATag_CSGTag */
  558. #define kQACSGTag_None            0xffffffffUL    /* Do not perform CSG */
  559. #define kQACSGTag_0                0                /* Submitted tris have CSG ID 0 */
  560. #define kQACSGTag_1                1                /* Submitted tris have CSG ID 1 */
  561. #define kQACSGTag_2                2                /* Submitted tris have CSG ID 2 */
  562. #define kQACSGTag_3                3                /* Submitted tris have CSG ID 3 */
  563. #define kQACSGTag_4                4                /* Submitted tris have CSG ID 4 */
  564.  
  565. /* kQATagGL_TextureWrapU/V */
  566. #define kQAGL_Repeat                0
  567. #define kQAGL_Clamp                    1
  568.  
  569. /* kQATagGL_BlendSrc */
  570. #define kQAGL_SourceBlend_XXX        0
  571.  
  572. /* kQATagGL_BlendDst */
  573. #define kQAGL_DestBlend_XXX            0
  574.  
  575. /* kQATagGL_DrawBuffer (mask of one or more) */
  576. #define kQAGL_DrawBuffer_None        0
  577. #define kQAGL_DrawBuffer_FrontLeft    (1<<0)
  578. #define kQAGL_DrawBuffer_FrontRight    (1<<1)
  579. #define kQAGL_DrawBuffer_BackLeft    (1<<2)
  580. #define kQAGL_DrawBuffer_BackRight    (1<<3)
  581. #define kQAGL_DrawBuffer_Front        (kQAGL_DrawBuffer_FrontLeft | kQAGL_DrawBuffer_FrontRight)
  582. #define kQAGL_DrawBuffer_Back        (kQAGL_DrawBuffer_BackLeft | kQAGL_DrawBuffer_BackRight)
  583.  
  584. /************************************************************************************************
  585.  *
  586.  * Constants used as function parameters.
  587.  *
  588.  ***********************************************************************************************/
  589.  
  590. /*
  591.  * TQAVertexMode is a parameter to QADrawVGouraud() and QADrawVTexture() that specifies how
  592.  * to interpret and draw the vertex array.
  593.  */
  594.  
  595. typedef enum TQAVertexMode
  596. {
  597.     kQAVertexMode_Point                = 0,        /* Draw nVertices points */
  598.     kQAVertexMode_Line                = 1,        /* Draw nVertices/2 line segments */
  599.     kQAVertexMode_Polyline            = 2,        /* Draw nVertices-1 connected line segments */
  600.     kQAVertexMode_Tri                = 3,        /* Draw nVertices/3 triangles */
  601.     kQAVertexMode_Strip                = 4,        /* Draw nVertices-2 triangles as a strip */
  602.     kQAVertexMode_Fan                = 5,            /* Draw nVertices-2 triangles as a fan from v0 */
  603.     kQAVertexMode_NumModes            = 6
  604.  
  605. } TQAVertexMode;
  606.  
  607. /*
  608.  * TQAGestaltSelector is a parameter to QAEngineGestalt(). It selects which gestalt
  609.  * parameter will be copied into 'response'.
  610.  */
  611.  
  612. typedef enum TQAGestaltSelector
  613. {
  614.     kQAGestalt_OptionalFeatures        = 0,        /* Mask of one or more kQAOptional_xxx */
  615.     kQAGestalt_FastFeatures            = 1,        /* Mask of one or more kQAFast_xxx */
  616.     kQAGestalt_VendorID                = 2,        /* Vendor ID */
  617.     kQAGestalt_EngineID                = 3,        /* Engine ID */
  618.     kQAGestalt_Revision                = 4,        /* Revision number of this engine */
  619.     kQAGestalt_ASCIINameLength        = 5,        /* strlen (asciiName) */
  620.     kQAGestalt_ASCIIName            = 6,        /* Causes strcpy (response, asciiName) */
  621.     kQAGestalt_TextureMemory        = 7,        /* amount of texture RAM currently available */
  622.     kQAGestalt_FastTextureMemory    = 8,        /* amount of texture RAM currently available */
  623.     kQAGestalt_NumSelectors            = 9
  624.  
  625. } TQAGestaltSelector;
  626.  
  627. /*
  628.  * TQAMethodSelector is a parameter to QASetNoticeMethod to select the notice method
  629.  */
  630.  
  631. typedef enum TQAMethodSelector
  632. {
  633.     kQAMethod_RenderCompletion        = 0,        /* Called when rendering has completed and buffers swapped */
  634.     kQAMethod_DisplayModeChanged    = 1,        /* Called when a display mode has changed */
  635.     kQAMethod_ReloadTextures        = 2,        /* Called when texture memory has been invalidated */
  636.     kQAMethod_BufferInitialize        = 3,        /* Called when a buffer needs to be initialized */
  637.     kQAMethod_BufferComposite        = 4,        /* Called when rendering is finished and its safe to composite */
  638.     kQAMethod_NumSelectors            = 5
  639.     
  640. } TQAMethodSelector;
  641.  
  642. /*
  643.  * kQATriFlags_xxx are ORed together to generate the 'flags' parameter
  644.  * to QADrawTriGouraud() and QADrawTriTexture().
  645.  */
  646.  
  647. #define    kQATriFlags_None            0            /* No flags (triangle is front-facing or don't care) */
  648. #define kQATriFlags_Backfacing        (1 << 0)    /* Triangle is back-facing */
  649.  
  650. /*
  651.  * kQATexture_xxx are ORed together to generate the 'flags' parameter to QATextureNew().
  652.  */
  653.  
  654. #define    kQATexture_None                0            /* No flags */
  655. #define kQATexture_Lock                (1<<0)        /* Don't swap this texture out */
  656. #define kQATexture_Mipmap            (1<<1)        /* This texture is mipmapped */
  657. #define kQATexture_NoCompression    (1<<2)        /* Do not compress this texture */
  658. #define kQATexture_HighCompression    (1<<3)        /* Compress texture, even if it takes a while */
  659.  
  660. /*
  661.  * kQABitmap_xxx are ORed together to generate the 'flags' parameter to QABitmapNew().
  662.  */
  663.  
  664. #define    kQABitmap_None                0            /* No flags */
  665. #define kQABitmap_Lock                (1<<1)        /* Don't swap this bitmap out */
  666. #define kQABitmap_NoCompression        (1<<2)        /* Do not compress this bitmap */
  667. #define kQABitmap_HighCompression    (1<<3)        /* Compress bitmap, even if it takes a while */
  668.  
  669. /*
  670.  * kQAContext_xxx are ORed together to generate the 'flags' parameter for QADrawContextNew().
  671.  */
  672.  
  673. #define kQAContext_None                0            /* No flags */
  674. #define kQAContext_NoZBuffer        (1 << 0)    /* No hidden surface removal */
  675. #define kQAContext_DeepZ            (1 << 1)    /* Hidden surface precision >= 24 bits */
  676. #define kQAContext_DoubleBuffer        (1 << 2)    /* Double buffered window */
  677. #define kQAContext_Cache            (1 << 3)    /* This is a cache context */
  678. #define kQAContext_NoDither            (1 << 4)    /* No dithering, straight color banding */
  679.  
  680. /*
  681.  * kQAOptional_xxx are ORed together to generate the kQAGestalt_OptionalFeatures response
  682.  * from QAEngineGestalt().
  683.  */
  684.  
  685. #define kQAOptional_None            0            /* No optional features */
  686. #define kQAOptional_DeepZ            (1 << 0)    /* Hidden surface precision >= 24 bits */
  687. #define kQAOptional_Texture            (1 << 1)    /* Texture mapping */
  688. #define kQAOptional_TextureHQ        (1 << 2)    /* High quality texture (tri-linear mip or better) */
  689. #define kQAOptional_TextureColor    (1 << 3)    /* Full color modulation and highlight of textures */
  690. #define kQAOptional_Blend            (1 << 4)    /* Transparency blending of RGB */
  691. #define kQAOptional_BlendAlpha        (1 << 5)    /* Transparency blending includes alpha channel */
  692. #define kQAOptional_Antialias        (1 << 6)    /* Antialiased rendering */
  693. #define kQAOptional_ZSorted            (1 << 7)    /* Z sorted rendering (for transparency, etc.) */
  694. #define kQAOptional_PerspectiveZ    (1 << 8)    /* Hidden surface removal using InvW instead of Z */
  695. #define kQAOptional_OpenGL            (1 << 9)    /* Extended rasterization features for OpenGL™ */
  696. #define kQAOptional_NoClear            (1 << 10)    /* This drawing engine doesn't clear before drawing */
  697. #define kQAOptional_CSG                (1 << 11)    /* kQATag_CSGxxx are implemented */
  698. #define kQAOptional_BoundToDevice    (1 << 12)    /* This engine is tightly bound to GDevice */
  699. #define kQAOptional_CL4                (1 << 13)    /* This engine suports kQAPixel_CL4 */
  700. #define kQAOptional_CL8                (1 << 14)    /* This engine suports kQAPixel_CL8 */
  701. #define kQAOptional_BufferComposite    (1 << 15)    /* This engine can composite with initial buffer contents */
  702. #define kQAOptional_NoDither        (1 << 16)    /* This engine can draw with no dithering */
  703.  
  704. /*
  705.  * kQAFast_xxx are ORed together to generate the kQAGestalt_FastFeatures response
  706.  * from QAEngineGestalt().
  707.  */
  708.  
  709. #define kQAFast_None                0            /* No accelerated features */
  710. #define kQAFast_Line                (1 << 0)    /* Line drawing */
  711. #define kQAFast_Gouraud                (1 << 1)    /* Gouraud shaded triangles */
  712. #define kQAFast_Texture                (1 << 2)    /* Texture mapped triangles */
  713. #define kQAFast_TextureHQ            (1 << 3)    /* High quality texture (tri-linear mip or better) */
  714. #define kQAFast_Blend                (1 << 4)    /* Transparency blending */
  715. #define kQAFast_Antialiasing        (1 << 5)    /* Antialiased rendering */
  716. #define kQAFast_ZSorted                (1 << 6)    /* Z sorted rendering of non-opaque objects */
  717. #define kQAFast_CL4                    (1 << 7)    /* This engine accelerates kQAPixel_CL4 */
  718. #define kQAFast_CL8                    (1 << 8)    /* This engine accelerates kQAPixel_CL8 */
  719.  
  720. /************************************************************************************************
  721.  *
  722.  * Macro definitions for the drawing engine methods included in TQADrawContext. These
  723.  * macros are the recommended means of accessing the engine's draw methods, e.g:
  724.  *
  725.  *        TQADrawContext    *drawContext;
  726.  *        TQAVTexture        vertices[3];
  727.  *
  728.  *        drawContext = QADrawContextNew (rect, gdevice, engine, kQAContext_ZBuffer);
  729.  *        ...
  730.  *        QASetInt (drawContext, kQATag_ZFunction, kQAZFunction_LT);
  731.  *        QADrawTriGouraud (drawContext, &vertices[0], &vertices[1], &vertices[2], kQATriFlags_None);
  732.  *
  733.  * Note that QARenderStart(), QARenderEnd(), QAFlush() and QASync() have real function
  734.  * definitions instead of macros. This is because these functions can afford the extra
  735.  * per-call overhead of a function layer (which makes application code a little smaller),
  736.  * and to allow a cleaner implementation of handling NULL parameters to QARenderStart().
  737.  *
  738.  ***********************************************************************************************/
  739.  
  740. #define QASetFloat(drawContext,tag,newValue) \
  741.         (drawContext)->setFloat (drawContext,tag,newValue)
  742.  
  743. #define QASetInt(drawContext,tag,newValue) \
  744.         (drawContext)->setInt (drawContext,tag,newValue)
  745.  
  746. #define QASetPtr(drawContext,tag,newValue) \
  747.         (drawContext)->setPtr (drawContext,tag,newValue)
  748.  
  749. #define QAGetFloat(drawContext,tag) \
  750.         (drawContext)->getFloat (drawContext,tag)
  751.  
  752. #define QAGetInt(drawContext,tag) \
  753.         (drawContext)->getInt (drawContext,tag)
  754.  
  755. #define QAGetPtr(drawContext,tag) \
  756.         (drawContext)->getPtr (drawContext,tag)
  757.  
  758. #define QADrawPoint(drawContext,v) \
  759.         (drawContext)->drawPoint (drawContext,v)
  760.  
  761. #define QADrawLine(drawContext,v0,v1) \
  762.         (drawContext)->drawLine (drawContext,v0,v1)
  763.  
  764. #define QADrawTriGouraud(drawContext,v0,v1,v2,flags) \
  765.         (drawContext)->drawTriGouraud (drawContext,v0,v1,v2,flags)
  766.  
  767. #define QADrawTriTexture(drawContext,v0,v1,v2,flags) \
  768.         (drawContext)->drawTriTexture (drawContext,v0,v1,v2,flags)
  769.  
  770. #define QASubmitVerticesGouraud(drawContext,nVertices,vertices) \
  771.         (drawContext)->submitVerticesGouraud(drawContext,nVertices,vertices)
  772.         
  773. #define QASubmitVerticesTexture(drawContext,nVertices,vertices) \
  774.         (drawContext)->submitVerticesTexture(drawContext,nVertices,vertices)
  775.         
  776. #define QADrawTriMeshGouraud(drawContext,nTriangle,triangles) \
  777.         (drawContext)->drawTriMeshGouraud (drawContext,nTriangle,triangles)
  778.  
  779. #define QADrawTriMeshTexture(drawContext,nTriangle,triangles) \
  780.         (drawContext)->drawTriMeshTexture (drawContext,nTriangle,triangles)
  781.  
  782. #define QADrawVGouraud(drawContext,nVertices,vertexMode,vertices,flags) \
  783.         (drawContext)->drawVGouraud (drawContext,nVertices,vertexMode,vertices,flags)
  784.  
  785. #define QADrawVTexture(drawContext,nVertices,vertexMode,vertices,flags) \
  786.         (drawContext)->drawVTexture (drawContext,nVertices,vertexMode,vertices,flags)
  787.  
  788. #define QADrawBitmap(drawContext,v,bitmap) \
  789.         (drawContext)->drawBitmap (drawContext,v,bitmap)
  790.  
  791. #define QARenderStart(drawContext,dirtyRect,initialContext) \
  792.         (drawContext)->renderStart (drawContext,dirtyRect,initialContext)
  793.  
  794. #define QARenderEnd(drawContext,modifiedRect) \
  795.         (drawContext)->renderEnd (drawContext,modifiedRect)
  796.  
  797. #define QARenderAbort(drawContext) \
  798.         (drawContext)->renderAbort (drawContext)
  799.  
  800. #define QAFlush(drawContext) \
  801.         (drawContext)->flush (drawContext)
  802.  
  803. #define QASync(drawContext) \
  804.         (drawContext)->sync (drawContext)
  805.  
  806. #define QASetNoticeMethod(drawContext, method, completionCallBack, refCon) \
  807.         (drawContext)->setNoticeMethod (drawContext, method, completionCallBack, refCon)
  808.  
  809. #define QAGetNoticeMethod(drawContext, method, completionCallBack, refCon) \
  810.         (drawContext)->getNoticeMethod (drawContext, method, completionCallBack, refCon)
  811.  
  812. /************************************************************************************************
  813.  *
  814.  * Typedefs of draw method functions provided by the drawing engine. One function pointer
  815.  * for each of these function types in stored in the TQADrawContext public data structure.
  816.  *
  817.  * These functions should be accessed through the QA<function>(context,...) macros,
  818.  * defined above.
  819.  *
  820.  ***********************************************************************************************/
  821.  
  822. typedef void (RAVE_CALLBACK *TQAStandardNoticeMethod)(
  823.     const TQADrawContext    *drawContext,        /* Draw context */
  824.     void                    *refCon);            /* user define parameter */
  825.  
  826. typedef void (RAVE_CALLBACK *TQABufferNoticeMethod)(
  827.     const TQADrawContext    *drawContext,        /* Draw context */
  828.     const TQADevice            *buffer,            /* TQADevice describing back buffer */
  829.     const TQARect            *dirtyRect,            /* Minimum area to process; NULL means whole buffer */
  830.     void                    *refCon);            /* user define parameter */
  831.  
  832. typedef union TQANoticeMethod
  833. {
  834.     TQAStandardNoticeMethod    standardNoticeMethod;    /* Used for non-buffer related methods */
  835.     TQABufferNoticeMethod    bufferNoticeMethod;        /* Used for buffer handling methods */
  836.     
  837. } TQANoticeMethod;
  838.  
  839. typedef void (RAVE_CALLBACK *TQASetFloat) (
  840.     TQADrawContext            *drawContext,        /* Draw context */
  841.     TQATagFloat                tag,                /* Tag of variable to set */
  842.     float                    newValue);            /* New value for variable */
  843.  
  844. typedef void (RAVE_CALLBACK *TQASetInt) (
  845.     TQADrawContext            *drawContext,        /* Draw context */
  846.     TQATagInt                tag,                /* Tag of variable to set */
  847.     unsigned long            newValue);            /* New value for variable */
  848.  
  849. typedef void (RAVE_CALLBACK *TQASetPtr) (
  850.     TQADrawContext            *drawContext,        /* Draw context */
  851.     TQATagPtr                tag,                /* Tag of variable to set */
  852.     const void                *newValue);            /* New value for variable */
  853.  
  854. typedef float (RAVE_CALLBACK *TQAGetFloat) (
  855.     const TQADrawContext    *drawContext,        /* Draw context */
  856.     TQATagFloat                tag);                /* Tag of variable to get */
  857.  
  858. typedef unsigned long (RAVE_CALLBACK *TQAGetInt) (
  859.     const TQADrawContext    *drawContext,        /* Draw context */
  860.     TQATagInt                tag);                /* Tag of variable to get */
  861.  
  862. typedef void *(RAVE_CALLBACK *TQAGetPtr) (
  863.     const TQADrawContext    *drawContext,        /* Draw context */
  864.     TQATagPtr                tag);                /* Tag of variable to get */
  865.  
  866. typedef void (RAVE_CALLBACK *TQADrawPoint) (
  867.     const TQADrawContext    *drawContext,        /* Draw context */
  868.     const TQAVGouraud        *v);                /* Vertex */
  869.  
  870. typedef void (RAVE_CALLBACK *TQADrawLine) (
  871.     const TQADrawContext    *drawContext,        /* Draw context */
  872.     const TQAVGouraud         *v0,                /* Vertex 0 */
  873.     const TQAVGouraud         *v1);                /* Vertex 1 */
  874.  
  875. typedef void (RAVE_CALLBACK *TQADrawTriGouraud) (
  876.     const TQADrawContext    *drawContext,        /* Draw context */
  877.     const TQAVGouraud         *v0,                /* Vertex 0 */
  878.     const TQAVGouraud         *v1,                /* Vertex 1 */
  879.     const TQAVGouraud         *v2,                /* Vertex 2 */
  880.     unsigned long            flags);                /* Mask of kQATriFlags_xxx flags */
  881.  
  882. typedef void (RAVE_CALLBACK *TQADrawTriTexture) (
  883.     const TQADrawContext    *drawContext,        /* Draw context */
  884.     const TQAVTexture         *v0,                /* Vertex 0 */
  885.     const TQAVTexture         *v1,                /* Vertex 1 */
  886.     const TQAVTexture         *v2,                /* Vertex 2 */
  887.     unsigned long            flags);                /* Mask of kQATriFlags_xxx flags */
  888.  
  889. typedef void (RAVE_CALLBACK *TQASubmitVerticesGouraud) (
  890.     const TQADrawContext        *drawContext,    /* Draw context */
  891.     unsigned long                 nVertices,        /* Number of vertices */
  892.     const TQAVGouraud             *vertices);        /* Array of vertices */
  893.     
  894. typedef void (RAVE_CALLBACK *TQASubmitVerticesTexture) (
  895.     const TQADrawContext        *drawContext,    /* Draw context */
  896.     unsigned long                 nVertices,        /* Number of vertices */
  897.     const TQAVTexture            *vertices);        /* Array of vertices */
  898.     
  899. typedef void (RAVE_CALLBACK *TQADrawTriMeshGouraud) (
  900.     const TQADrawContext        *drawContext,    /* Draw context */
  901.     unsigned long                 nTriangles,        /* Number of triangles */
  902.     const TQAIndexedTriangle    *triangles);    /* Array of triangles */
  903.     
  904. typedef void (RAVE_CALLBACK *TQADrawTriMeshTexture) (
  905.     const TQADrawContext        *drawContext,    /* Draw context */
  906.     unsigned long                 nTriangles,        /* Number of triangles */
  907.     const TQAIndexedTriangle     *triangles);    /* Array of triangles */
  908.  
  909. typedef void (RAVE_CALLBACK *TQADrawVGouraud) (
  910.     const TQADrawContext    *drawContext,        /* Draw context */
  911.     unsigned long            nVertices,            /* Number of vertices */
  912.     TQAVertexMode            vertexMode,            /* One of kQAVertexMode_xxx enumerated values */
  913.     const TQAVGouraud         vertices[],            /* Array of vertices */
  914.     const unsigned long        flags[]);            /* Array of per-triangle flags (or NULL) */
  915.  
  916. typedef void (RAVE_CALLBACK *TQADrawVTexture) (
  917.     const TQADrawContext    *drawContext,        /* Draw context */
  918.     unsigned long            nVertices,            /* Number of vertices */
  919.     TQAVertexMode            vertexMode,            /* One of kQAVertexMode_xxx enumerated values */
  920.     const TQAVTexture         vertices[],            /* Array of vertices */
  921.     const unsigned long        flags[]);            /* Array of per-triangle flags (or NULL) */
  922.  
  923. typedef void (RAVE_CALLBACK *TQADrawBitmap) (
  924.     const TQADrawContext    *drawContext,        /* Draw context */
  925.     const TQAVGouraud         *v,                    /* xyz, and (if a 1 bit/pixel bitmap) argb */
  926.     TQABitmap                *bitmap);            /* Previously allocated by QABitmapNew() */
  927.  
  928. typedef void (RAVE_CALLBACK *TQARenderStart) (
  929.     const TQADrawContext    *drawContext,        /* Draw context */
  930.     const TQARect            *dirtyRect,            /* Minimum area to clear; NULL means whole buffer */
  931.     const TQADrawContext    *initialContext);    /* Initial background image (or NULL) */
  932.  
  933. typedef TQAError (RAVE_CALLBACK *TQARenderEnd) (
  934.     const TQADrawContext    *drawContext,        /* Draw context */
  935.     const TQARect            *modifiedRect);        /* Minimum area to swap; NULL means whole buffer */
  936.  
  937. typedef TQAError (RAVE_CALLBACK *TQARenderAbort) (
  938.     const TQADrawContext    *drawContext);        /* Draw context */
  939.  
  940. typedef TQAError (RAVE_CALLBACK *TQAFlush) (
  941.     const TQADrawContext    *drawContext);        /* Draw context */
  942.  
  943. typedef TQAError (RAVE_CALLBACK *TQASync) (
  944.     const TQADrawContext    *drawContext);        /* Draw context */
  945.  
  946. typedef TQAError (RAVE_CALLBACK *TQASetNoticeMethod)(
  947.     const TQADrawContext    *drawContext,        /* Draw context */
  948.     TQAMethodSelector        method,
  949.     TQANoticeMethod            completionCallBack,
  950.     void                    *refCon);
  951.  
  952. typedef TQAError (RAVE_CALLBACK * TQAGetNoticeMethod)(
  953.     const TQADrawContext    *drawContext,        /* Draw context */
  954.     TQAMethodSelector        method,
  955.     TQANoticeMethod            *completionCallBack,
  956.     void                    **refCon);
  957.  
  958. /************************************************************************************************
  959.  *
  960.  * Public TQADrawContext structure. This contains function pointers for the chosen
  961.  * drawing engine.
  962.  *
  963.  ***********************************************************************************************/
  964.  
  965. /*
  966.  * TQAVersion sets the TQADrawContext 'version' field. It is set by
  967.  * the manager to indicate the version of the TQADrawContext structure.
  968.  */
  969.  
  970. typedef enum TQAVersion
  971. {
  972.     kQAVersion_Prerelease        = 0,
  973.     kQAVersion_1_0                = 1,
  974.     kQAVersion_1_0_5            = 2,            /* Added tri mesh functions, color tables */
  975.     kQAVersion_1_5                = 3                /* Added call backs, texture compression, and new error return code */
  976.  
  977. } TQAVersion;
  978.  
  979. struct TQADrawContext
  980. {
  981.     TQADrawPrivate            *drawPrivate;        /* Engine's private data for this context */
  982.     const TQAVersion        version;            /* Version number */
  983.     TQASetFloat                setFloat;            /* Method: Set a float state variable */
  984.     TQASetInt                setInt;                /* Method: Set an unsigned long state variable */
  985.     TQASetPtr                setPtr;                /* Method: Set an unsigned long state variable */
  986.     TQAGetFloat                getFloat;            /* Method: Get a float state variable */
  987.     TQAGetInt                getInt;                /* Method: Get an unsigned long state variable */
  988.     TQAGetPtr                getPtr;                /* Method: Get an pointer state variable */
  989.     TQADrawPoint            drawPoint;            /* Method: Draw a point */
  990.     TQADrawLine                drawLine;            /* Method: Draw a line */
  991.     TQADrawTriGouraud        drawTriGouraud;        /* Method: Draw a Gouraud shaded triangle */
  992.     TQADrawTriTexture        drawTriTexture;        /* Method: Draw a texture mapped triangle */
  993.     TQADrawVGouraud            drawVGouraud;        /* Method: Draw Gouraud vertices */
  994.     TQADrawVTexture            drawVTexture;        /* Method: Draw texture vertices */
  995.     TQADrawBitmap            drawBitmap;            /* Method: Draw a bitmap */
  996.     TQARenderStart            renderStart;        /* Method: Initialize for rendering */
  997.     TQARenderEnd            renderEnd;            /* Method: Complete rendering and display */
  998.     TQARenderAbort            renderAbort;        /* Method: Abort any outstanding rendering (blocking) */
  999.     TQAFlush                flush;                /* Method: Start render of any queued commands (non-blocking) */
  1000.     TQASync                    sync;                /* Method: Wait for completion of all rendering (blocking) */
  1001.     TQASubmitVerticesGouraud    submitVerticesGouraud;    /* Method: Submit Gouraud vertices for trimesh */
  1002.     TQASubmitVerticesTexture    submitVerticesTexture;    /* Method: Submit Texture vertices for trimesh */
  1003.     TQADrawTriMeshGouraud        drawTriMeshGouraud;        /* Method: Draw a Gouraud triangle mesh */
  1004.     TQADrawTriMeshTexture        drawTriMeshTexture;        /* Method: Draw a Texture triangle mesh */
  1005.     TQASetNoticeMethod            setNoticeMethod;        /* Method: Set a notice method */
  1006.     TQAGetNoticeMethod            getNoticeMethod;        /* Method: Get a notice method */
  1007. };
  1008.  
  1009. /************************************************************************************************
  1010.  *
  1011.  * Acceleration manager function prototypes.
  1012.  *
  1013.  ***********************************************************************************************/
  1014.  
  1015. RAVE_EXPORT TQAError RAVE_CALL QADrawContextNew (
  1016.     const TQADevice    *device,                /* Target device */
  1017.     const TQARect    *rect,                    /* Target rectangle (device coordinates) */
  1018.     const TQAClip    *clip,                    /* 2D clip region */
  1019.     const TQAEngine    *engine,                /* Drawing engine to use */
  1020.     unsigned long    flags,                    /* Mask of kQAContext_xxx */
  1021.     TQADrawContext    **newDrawContext);        /* (Out) Newly created TQADrawContext */
  1022.  
  1023. RAVE_EXPORT void RAVE_CALL QADrawContextDelete (
  1024.     TQADrawContext    *drawContext);            /* Context to delete */
  1025.  
  1026. RAVE_EXPORT TQAError RAVE_CALL QAColorTableNew(
  1027.     const TQAEngine        *engine,            /* Drawing engine to use */
  1028.     TQAColorTableType    tableType,            /* Depth, color space, etc. */
  1029.     void                *pixelData,            /* lookup table entries in pixelType format */
  1030.     long                transparentIndexFlag,    /* boolean, false means no transparency, true means index 0 is transparent */
  1031.     TQAColorTable        **newTable);        /* (Out) Newly created TQAColorTable */
  1032.  
  1033. RAVE_EXPORT void RAVE_CALL QAColorTableDelete(
  1034.     const TQAEngine        *engine,            /* Drawing engine to use */
  1035.     TQAColorTable        *colorTable);        /* Previously allocated by QAColorTableNew() */
  1036.  
  1037. RAVE_EXPORT TQAError RAVE_CALL QATextureNew (
  1038.     const TQAEngine        *engine,            /* Drawing engine to use */
  1039.     unsigned long        flags,                /* Mask of kQATexture_xxx flags */
  1040.     TQAImagePixelType    pixelType,            /* Depth, color space, etc. */
  1041.     const TQAImage        images[],            /* Image(s) for texture */
  1042.     TQATexture            **newTexture);        /* (Out) Newly created TQATexture, or NULL on error */ 
  1043.  
  1044. RAVE_EXPORT TQAError RAVE_CALL QATextureDetach (
  1045.     const TQAEngine        *engine,            /* Drawing engine to use */
  1046.     TQATexture            *texture);            /* Previously allocated by QATextureNew() */
  1047.  
  1048. RAVE_EXPORT void RAVE_CALL QATextureDelete (
  1049.     const TQAEngine        *engine,            /* Drawing engine to use */
  1050.     TQATexture            *texture);            /* Previously allocated by QATextureNew() */
  1051.  
  1052. RAVE_EXPORT TQAError RAVE_CALL QATextureBindColorTable(
  1053.     const TQAEngine        *engine,            /* Drawing engine to use */
  1054.     TQATexture            *texture,            /* Previously allocated by QATextureNew() */
  1055.     TQAColorTable        *colorTable);        /* Previously allocated by QAColorTableNew() */
  1056.     
  1057. RAVE_EXPORT TQAError RAVE_CALL QABitmapNew (
  1058.     const TQAEngine        *engine,            /* Drawing engine to use */
  1059.     unsigned long        flags,                /* Mask of kQABitmap_xxx flags */
  1060.     TQAImagePixelType    pixelType,            /* Depth, color space, etc. */
  1061.     const TQAImage        *image,                /* Image */
  1062.     TQABitmap            **newBitmap);        /* (Out) Newly created TQABitmap, or NULL on error */ 
  1063.  
  1064. RAVE_EXPORT TQAError RAVE_CALL QABitmapDetach (
  1065.     const TQAEngine        *engine,            /* Drawing engine to use */
  1066.     TQABitmap            *bitmap);            /* Previously allocated by QABitmapNew() */
  1067.  
  1068. RAVE_EXPORT void RAVE_CALL QABitmapDelete (
  1069.     const TQAEngine        *engine,            /* Drawing engine to use */
  1070.     TQABitmap            *bitmap);            /* Previously allocated by QABitmapNew() */
  1071.  
  1072. RAVE_EXPORT TQAError RAVE_CALL QABitmapBindColorTable(
  1073.     const TQAEngine        *engine,            /* Drawing engine to use */
  1074.     TQABitmap            *bitmap,            /* Previously allocated by QABitmapNew() */
  1075.     TQAColorTable        *colorTable);        /* Previously allocated by QAColorTableNew() */
  1076.     
  1077. RAVE_EXPORT TQAEngine *RAVE_CALL QADeviceGetFirstEngine (
  1078.     const TQADevice    *device);                /* Target device */
  1079.  
  1080. RAVE_EXPORT TQAEngine *RAVE_CALL QADeviceGetNextEngine (
  1081.     const TQADevice    *device,                /* Target device */
  1082.     const TQAEngine    *currentEngine);        /* Engine after 'currentEngine' is returned */
  1083.  
  1084. RAVE_EXPORT TQAError RAVE_CALL QAEngineCheckDevice (
  1085.     const TQAEngine    *engine,                /* Engine to check on 'device' */
  1086.     const TQADevice    *device);                /* Target device */
  1087.  
  1088. RAVE_EXPORT TQAError RAVE_CALL QAEngineGestalt (
  1089.     const TQAEngine        *engine,            /* Engine being queried */
  1090.     TQAGestaltSelector    selector,            /* Gestalt parameter being requested */
  1091.     void                *response);            /* Buffer that receives response */
  1092.  
  1093. RAVE_EXPORT TQAError RAVE_CALL QAEngineEnable (
  1094.     long            vendorID,                /* Vendor ID of engine to enable */
  1095.     long            engineID);                /* Engine ID of engine to enable */
  1096.  
  1097. RAVE_EXPORT TQAError RAVE_CALL QAEngineDisable (
  1098.     long            vendorID,                /* Vendor ID of engine to disable */
  1099.     long            engineID);                /* Engine ID of engine to disable */
  1100.  
  1101. #ifdef __cplusplus
  1102. }
  1103. #endif
  1104.  
  1105. #endif /* _RAVE_h */
  1106.